package com.demo;

import com.okhttp.retrofit.BaseResponse;
import com.okhttp.retrofit.BaseResponseBodyHandler;
import com.okhttp.retrofit.BaseResponseHandler;
import com.okhttp.retrofit.RetrofitClient;
import java.io.IOException;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;


public class NetRequest {

  private static Net _innerCall;

  private static Net _innerCall(){
    if(_innerCall==null){
      return RetrofitClient.getInstance().createService(Net.class);
    }
    return _innerCall;
  }


  public void doGet3(String test, BaseResponseHandler<DataBean,Result<DataBean>> handler){
    Call<Result<DataBean>> call = _innerCall().doGet3(test);
    call.enqueue(handler);
  }


  public static  void doGet2(String test, Callback<DataBean> handler) {
    //Call<ResponseBody> getIndexPost(@Field("postTest") String test);
    Call<DataBean> indexPost2 = _innerCall().doGet2(test);
    indexPost2.enqueue(handler);
    //Call<ResponseBody> call = innerCall().getIndexPost(test);
    //call.enqueue(handler);
  }


  public void doGet6( String test,Callback<DataBean> callback){
    Call<ResponseBody> call=_innerCall().doGet6(test);
    try {
      Response<ResponseBody> execute = call.execute();
      //return execute;
    } catch (IOException e) {
      e.printStackTrace();
    }
  }



}
